using System;
using TwitterLib;
using System.Threading;

namespace TwitterLibTest
{
	class MainClass
	{
		public static void Main (string[] args)
		{
            new MainClass();
		}

        public MainClass()
        {
            Console.WriteLine("The program will open a web browser to authenticate you on Twitter.");

            Twitter t = new Twitter();

            Console.Write("PIN: ");

            if (t.setPin(Console.ReadLine()))
            {
                Console.WriteLine("Succesfully spammed your timeline.");
            }
            else
            {
                Console.WriteLine("Something, somewhere, went terribly wrong.");
            }

            t.TwitterMessageReceived += new Twitter.TwitterMessageHandler(ParseMessage);

            while (true)
            {
                Thread.Sleep(Int32.MaxValue);
            }
        }

        public void ParseMessage(object feedback, TwitterEventArgs msg)
        {
            Console.WriteLine(msg.message);
        }
	}
}

